package com.colin.loader;

/**
 * @author colin
 * @create 2022-09-24 14:15
 */
public class ClassLoaderDemo {

    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        /*String s = new String();
        System.out.println("String类加载器" + s.getClass().getClassLoader());
        ColinEntity colinEntity = new ColinEntity();
        System.out.println("colinEntity 类加载器" + colinEntity.getClass().getClassLoader());*/

        // 读取class文件到内存中 com.colin.loader.ColinEntity
        /*Class<?> aClass = ClassLoader.getSystemClassLoader().loadClass("com.colin.loader.ColinEntity");
        Object o = aClass.newInstance();
        System.out.println(o);*/
//        MayiktEntity mayikt01 = new MayiktEntity();
//        MayiktEntity mayikt02 = new MayiktEntity();
////        System.out.println(mayiktEntity.getClass().getClassLoader());
//        MayiktEntity mayiktEntity = new MayiktEntity();

        ClassLoader classLoader = ClassLoaderDemo.class.getClassLoader();
        while (classLoader != null){
            System.out.println(classLoader);
            classLoader = classLoader.getParent();
        }
    }
}

class ColinEntity{

}